/*
Copyright [2023] [fuwen_soft]
*/
package vip.xiaonuo.modular.xypdf.controller;

import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.xypdf.param.XyPdfParam;
import vip.xiaonuo.modular.xypdf.service.XyPdfService;
import vip.xiaonuo.modular.xypdf.entity.XyPdf;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.core.annotion.version.AdminVersionSwagger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
import vip.xiaonuo.sys.core.msg.Result;
import static vip.xiaonuo.sys.core.msg.ResultUtils.success;
/**
 * 谱书控制器
 *
 * @author yanwei
 * @date 2023-05-05 15:44:28
 */
@RestController
@Api(tags = "后台管理 谱书 相关APIS")
@AdminVersionSwagger
public class XyPdfController {

    @Resource
    private XyPdfService xyPdfService;

    /**
     * 查询谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyPdf/page")
    @BusinessLog(title = "谱书_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱书_查询")
    public Result<PageResult<XyPdf>> page(XyPdfParam xyPdfParam) {
        PageResult<XyPdf> page = xyPdfService.page(xyPdfParam);
        return success(page);
    }

    /**
     * 添加谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyPdf/add")
    @BusinessLog(title = "谱书_增加", opType = LogAnnotionOpTypeEnum.ADD)
    @ApiOperation("谱书_增加")
    public Result add(@RequestBody @Validated(XyPdfParam.add.class) XyPdfParam xyPdfParam) {
            xyPdfService.add(xyPdfParam);
        return success();
    }

    /**
     * 删除谱书，可批量删除
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyPdf/delete")
    @BusinessLog(title = "谱书_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    @ApiOperation("谱书_删除")
    public Result delete(@RequestBody @Validated(XyPdfParam.delete.class) List<XyPdfParam> xyPdfParamList) {
            xyPdfService.delete(xyPdfParamList);
        return success();
    }

    /**
     * 编辑谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyPdf/edit")
    @BusinessLog(title = "谱书_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    @ApiOperation("谱书_编辑")
    public Result edit(@RequestBody @Validated(XyPdfParam.edit.class) XyPdfParam xyPdfParam) {
            xyPdfService.edit(xyPdfParam);
        return success();
    }

    /**
     * 查看谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyPdf/detail")
    @BusinessLog(title = "谱书_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    @ApiOperation("谱书_查看")
    public Result<XyPdf> detail(@Validated(XyPdfParam.detail.class) XyPdfParam xyPdfParam) {
        XyPdf detail =   xyPdfService.detail(xyPdfParam);
        return success(detail);
    }

    /**
     * 谱书列表
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyPdf/list")
    @BusinessLog(title = "谱书_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱书_列表")
    public Result<List<XyPdf>> list(XyPdfParam xyPdfParam) {
        List<XyPdf> list  =   xyPdfService.list(xyPdfParam);
        return success(list);
    }

    /**
     * 导出系统用户
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyPdf/export")
    @BusinessLog(title = "谱书_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    @ApiOperation("谱书_导出")
    public void export(XyPdfParam xyPdfParam) {
        xyPdfService.export(xyPdfParam);
    }

}
